Why can't I find `len(list)` in Python?

Posted by FarmBoy on Stack Overflow See other posts from Stack Overflow or by FarmBoy
Published on 2010-03-09T11:18:58Z Indexed on 2010/03/09 11:21 UTC
Read the original article Hit count: 390

Filed under:
|

I'm new to Python. I have a method that begins:

def foo(self, list):
    length = len(list)

I've called len() successfully in other cases, but here I get:

TypeError: object of type 'type' has no len()

How do I convince Python that this object passed in is a list? What am I missing?

© Stack Overflow or respective owner

Related posts about python

Related posts about beginner